import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
//牛客：点击消除
//用StringBuilder模拟栈，不用再逆序可以直接输出
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char []s=in.next().toCharArray();
        StringBuilder st=new StringBuilder();
        for(int i=0;i<s.length;i++){
            char ch=s[i];
            if(st.length()!= 0&&st.charAt(st.length()-1)==ch ){
                //出栈
                st.deleteCharAt(st.length()-1);
            }else{
                //入栈
                st.append(ch);
            }
        }
        if(st.length()==0){
            System.out.print(0);
            return;
        }
        System.out.print(st);
    }
    //牛客，最小花费爬楼梯，动态规划
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int []cost=new int[n];
        for(int i=0;i<n;i++){
            cost[i]=in.nextInt();
        }
        //状态表示
        int []dp=new int[n+1];
        dp[0]=0;
        dp[1]=0;
        for(int i=2;i<=n;i++){
            //状态转移方程
            dp[i]=Math.min(dp[i-1]+cost[i-1],dp[i-2]+cost[i-2]);
        }
        if(n==1){System.out.print(cost[0]);
            return;
        }
        System.out.print(dp[n]);
    }
    //牛客。数组中两个字符串的最小距离

        public static void main2(String[] args) throws IOException {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int n = Integer.parseInt(reader.readLine());
            String[] str = reader.readLine().split(" ");
            String s1 = str[0];
            String s2 = str[1];
            int prev1 = -1, prev2 = -1;
            int ret = Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                String s = reader.readLine();
                if (s.equals(s1)) {
                    if (prev2 != -1) {
                        ret = Math.min(ret, i - prev2);
                    }
                    prev1 = i;
                } else if (s.equals(s2)) {
                    if (prev1 != -1) {
                        ret = Math.min(ret, i - prev1);
                    }
                    prev2 = i;
                }
            }
            System.out.println(ret == Integer.MAX_VALUE ? -1 : ret);
        }

}